var a = getApp();

Page({
    data: {
        teamArray: [ {
            name: "二维码制作",
            members: [ "属于自己的名片" ],
            img: "../../i/1.png"
        }, {
            name: "微信运动",
            members: [ "给自己制定一个时间计划" ],
            img: "../../i/3.png"
        }, {
            name: "随笔录",
            members: [ "记录美好的你" ],
            img: "../../i/2.png"
        }, {
            name: "建议",
            members: [ "谢谢您提供宝贵的建议" ],
            img: "../../i/4.png"
        } ],
        canIUse: wx.canIUse("button.open-type.getUserInfo"),
        show: 0,
        userInfo: null,
        shareTalks: [ "时间是一切财富中最宝贵的财富！", "爱情不过是一种疯！", "再不疯狂，我们就老啦！", "难过，伤心，找客服小哥哥哦！", "难过，伤心，找客服小姐姐哦！", "无聊？不开心？，请找客服小姐姐！", "最灵繁的人也看不见自己的背脊！", "无聊？不开心？，请找客服小哥哥！", "我这个人走得很慢，但是我从不后退！", "来啊，找客服小姐姐尬聊啊！", "来啊，找客服小哥哥尬聊啊！", "青春时种下什么，老年时就收获什么！", "功能太枯燥？那就提出建议给客服！", "勤能补拙是良训，一分辛劳一分才！", "现在不努力，将来是单身！", "现在不奋斗，将来空空如也！", "来点小创意，可以联系客服小哥哥！", "来点小创意，可以联系客服小姐姐！" ]
    },
    count: function(a) {},
    goTools: function(a) {
        if (1 != !this.data.show) {
            var e = a.target.dataset.sel;
            0 == e ? wx.navigateTo({
                url: "../main/main"
            }) : 1 == e ? wx.navigateTo({
                url: "../run/run"
            }) : 2 == e ? wx.navigateTo({
                url: "../text/text"
            }) : 3 == e && wx.navigateTo({
                url: "../advice/advice"
            });
        } else wx.showToast({
            title: this.data.canIUse ? "请先授权登录" : "请先升级微信版本",
            icon: "none",
            duration: 1500
        });
    },
    onLoad: function() {
        var e = this;
        wx.getSetting({
            success: function(t) {
                t.authSetting["scope.userInfo"] ? wx.getUserInfo({
                    success: function(t) {
                        e.setData({
                            userInfo: t.userInfo,
                            show: 1
                        }), a.globalData.userInfo = t.userInfo;
                    }
                }) : (e.setData({
                    userInfo: null,
                    show: 0
                }), a.globalData.userInfo = null);
            }
        });
    },
    bindGetUserInfo: function(e) {
        e.detail.rawData ? (this.setData({
            userInfo: e.detail.userInfo,
            show: 1
        }), a.globalData.userInfo = e.detail.userInfo) : this.setData({
            userInfo: null,
            show: 0
        });
    },
    onShareAppMessage: function(a) {
        a.from;
        var e = Math.floor(5 * Math.random()), t = this.data.shareTalks;
        return {
            title: t[Math.floor(Math.random() * t.length)],
            path: "/pages/calendar/calendar?id=123",
            imageUrl: "../../i/share" + e + ".png"
        };
    }
});